<script>
import Vue from 'vue';
export default {
	onLaunch() {
		// #ifdef APP-PLUS
		plus.device.getInfo({
			success(e) {
				uni.setStorageSync('token', e.uuid);
				console.log('getDeviceInfo success: ' + JSON.stringify(e));
			},
			fail(e) {
				console.log('getDeviceInfo failed: ' + JSON.stringify(e));
			}
		});
		// #endif
		let systemInfo = uni.getSystemInfoSync();
		console.log(systemInfo);
		// #ifndef MP
		Vue.prototype.StatusBar = systemInfo.statusBarHeight;
		if (systemInfo.platform == 'android') {
			Vue.prototype.CustomBar = systemInfo.statusBarHeight + 50;
		} else {
			Vue.prototype.CustomBar = systemInfo.statusBarHeight + 45;
		}
		// #endif

		// #ifdef MP-WEIXIN
		Vue.prototype.StatusBar = systemInfo.statusBarHeight;
		let custom = wx.getMenuButtonBoundingClientRect();
		Vue.prototype.Custom = custom;
		Vue.prototype.CustomBar = custom.bottom + custom.top - systemInfo.statusBarHeight;
		// #endif

		// #ifdef MP-ALIPAY
		Vue.prototype.StatusBar = systemInfo.statusBarHeight;
		Vue.prototype.CustomBar = systemInfo.statusBarHeight + systemInfo.titleBarHeight;
		// #endif
	},
	onShow: function() {
		this.$store.commit('setMessageAdd', true);
	},
	onHide: function() {
		this.$store.commit('setMessageAdd', false);
	},
	onUnload() {
		let deviceId = this.$store.state.deviceId;
		if (deviceId) {
			uni.closeBLEConnection({
				deviceId,
				success(res) {
					console.log(res);
				}
			});
		}
	}
};
</script>

<style lang="scss">
@import 'uview-ui/index.scss';
@import 'colorui/main.css';
@import 'colorui/icon.css';

.uni-swiper-slides {
	margin-bottom: 0 !important;
}
.clamp {
	lines: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
/* 点击态 */
.hover-gray {
	background: #fafafa !important;
}

.hover-dark {
	background: #f0f0f0 !important;
}

.hover-opacity {
	opacity: 0.8;
}
</style>
